<?php
/**
 * 商品分类
 * User: yuanxuncheng
 * Date: 2017/1/2
 * Time: 21:45
 */

namespace app\api\controller;

use app\api\model\page\goods\DeleteGoodsCategory;
use app\api\model\page\goods\GetGoodsCategory as GetGoodsCategoryModel;
use app\api\model\page\goods\GetSubGoodsCategory as GetSubGoodsCategoryModel;
use app\api\model\page\goods\AddGoodsCategory as AddGoodsCategoryModel;
use app\api\model\page\goods\EditGoodsCategory as EditGoodsCategoryModel;
use think\Request;

class GoodsCategory
{

    private $addGoodsCategoryModel;
    private $editGoodsCategoryModel;
    private $getGoodsCategoryModel;
    private $getSubGoodsCategoryModel;

    public function __construct()
    {
        $this->param = Request::instance()->param();
    }

    /**
     * @desc 增加商品分类
     * @return array
     */
    public function addGoodsCategory()
    {
        $this->addGoodsCategoryModel = new AddGoodsCategoryModel();
        return $this->addGoodsCategoryModel->excute($this->param);
    }

    /**
     * @desc 编辑商品分类
     * @return array
     */
    public function editGoodsCategory()
    {
        $this->editGoodsCategoryModel = new EditGoodsCategoryModel();
        return $this->editGoodsCategoryModel->excute($this->param);
    }

    /**
     * @desc 获取商品分类
     * @return array
     */
    public function getGoodsCategory()
    {
        $this->getGoodsCategoryModel = new GetGoodsCategoryModel();
        return $this->getGoodsCategoryModel->excute($this->param);
    }

    /**
     * @desc 获取商品子分类
     * @return array
     */
    public function getSubGoodsCategory()
    {
        $this->getSubGoodsCategoryModel = new GetSubGoodsCategoryModel();
        return $this->getSubGoodsCategoryModel->excute($this->param);
    }

    public function deleteGoodsCategory()
    {
        $obj = new DeleteGoodsCategory();
        return $obj->excute($this->param);
    }
}
